/*
 * @Author: lininghua 0027012803@iwhalecloud.com
 * @Date: 2022-05-10 00:20:21
 * @LastEditors: lininghua 0027012803@iwhalecloud.com
 * @LastEditTime: 2022-06-13 15:02:56
 * @FilePath: /flowplatform-fe-sf/src/pages/flowmonitor/eventlist/components/EventColumns.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React from "react";
import styles from "./eventColumns.less";

const Columns = (handleEdit) => [
  {
    title: "id",
    dataIndex: "id",
  },
  {
    title: "模型编码",
    dataIndex: "modelKey",
  },
  {
    title: "模型名称",
    dataIndex: "modelName",
  },
  {
    title: "模型id",
    dataIndex: "modelId",
  },
  {
    title: "节点名称",
    dataIndex: "nodeName",
  },
  {
    title: "事件名称",
    dataIndex: "name",
  },
  {
    title: "事件类型",
    dataIndex: "callMethod",
    // render: value => (value === "sync" ? "同步" : "异步"),
    render: (text)=> {
      if(text === "sync") return "同步";
      if(text === "async") return "异步";
      else return "";
    },
  },
  {
    title: "触发时机",
    dataIndex: "eventType",
    // value === "ACTIVITY_STARTED" ? "流程前置" : "流程后置"
    render: (text)=> {
      if(text === "ACTIVITY_STARTED" || text === "TASK_CREATED" ) return "流程前置";
      if(text === "ACTIVITY_COMPLETED" || text === "TASK_COMPLETED" ) return "流程后置";
      else return "";
    },
  
    
    
  },
  {
    title: "节点编码",
    dataIndex: "nodeCode",
  },
  {
    title: "事件备注",
    dataIndex: "desc",
  },
  // {
  //   title: "请求URL",
  //   dataIndex: "config",
  //   render: (text, record) => (
  //     <span>
  //       {record.config.url}
  //     </span>
  //   ),
  // },
  {
    title: "请求地址",
    dataIndex: "configContent",
  },
  {
    title: "请求体",
    dataIndex: "requestBody",
  },
  {
    title: "查看详情",
    render: (record) =>{
      if(record.id>100){
        return (
          <div>
            <a className={styles.blue} onClick={() => handleEdit(record)}>详情</a>
          </div>
        )
      }
      else{
        return "";
      }
  },
  },
];

export default Columns;
